package com.koro.controller;

import com.koro.dto.FindGoodsDTO;
import com.koro.service.GoodsService;
import com.koro.vo.FindGoodsVO;
import com.koro.vo.ResponseObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "商品管理")
@RequestMapping("/goods")
@RestController
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @ApiOperation(value = "分页查询商品",notes = "分页查询")
    @PostMapping("/findAll")
    public ResponseObject<List<FindGoodsVO>> findAll(@RequestBody FindGoodsDTO dto) {
        return ResponseObject.ok(goodsService.findAll(dto));
    }
}
